package com.example.demo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.mapper.AlbumMapper;
import com.example.demo.po.Album;
import com.example.demo.po.AlbumExample;
import com.example.demo.po.Menu;
import com.example.demo.po.MenuExample;
import com.example.demo.po.Others;
import com.example.demo.po.OthersExample;
import com.example.demo.service.AlbumService;
@Service
public class AlbumServiceImpl implements AlbumService {
	
	@Autowired
	private AlbumMapper albumMapper;

	@Override
	public void insert(Album t) {
		// TODO Auto-generated method stub
		albumMapper.insertSelective(t);
	}

	@Override
	public void update(Album t) {
		// TODO Auto-generated method stub
		albumMapper.updateByPrimaryKey(t);
	}
	
	@Override
	public void delete(String id) {
		// TODO Auto-generated method stub
		albumMapper.deleteByPrimaryKey(id);
	}
	
	@Override
	public Album selectById(String id) {
		// TODO Auto-generated method stub
		return albumMapper.selectByPrimaryKey(id);
	}
	
	@Override
	public List<Album> selectAll() {
		// TODO Auto-generated method stub
		return albumMapper.selectByExample(null);
	}

	
	@Override
	public void delete(int id) {
		// TODO Auto-generated method stub
	}

	@Override
	public Album selectById(int id) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Album> getPic(){
		AlbumExample example = new AlbumExample();
		AlbumExample.Criteria criteria = example.createCriteria();
		criteria.andTagsEqualTo("新闻轮播图");
		return albumMapper.selectByExample(example);
	}
	
	public List<Album> getImg(){
		AlbumExample example = new AlbumExample();
		AlbumExample.Criteria criteria = example.createCriteria();
		criteria.andTagsEqualTo("首页轮播图");
		return albumMapper.selectByExample(example);
	}
	
}
